<template>
	<view class="itemlist">
		<view class="item" v-for="item in MenuList" :key="item._id" >
			<view class="imgbox">
				<image :src="item.url" mode=""></image>
			</view>
			<view class="menu_name">
				{{ item.name ? item.name : "菜单名称" }}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				MenuList: [],
			}
		},
		mounted() {
			this.getMenuList()
		},
		methods: {
			// 获取菜单按钮
			async getMenuList() {
				let res = await this.$Request("/indexpage/showMenu", "")
				// console.log(res);
				let code = res.data.code
				if(code == 200) {
					this.MenuList = res.data.data
				}
			},
		}
	}
</script>

<style scoped lang="scss">
	.itemlist {
		width: 100%;
		padding: 10rpx 25rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		flex-wrap: wrap;
		.item {
			width: 140rpx;
			text-align: center;
			padding: 10rpx;
			box-sizing: border-box;
			font-size: 22rpx;
			text-align: center;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			.imgbox{
				width: 100rpx;
				text-align: center;
				height: 100rpx;
				border-radius: 50%;
				overflow: hidden;
				image {
					width: 100rpx;
					height: 100rpx;
				}
			}
		}
	}
</style>
